﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Oragon.Architecture.Data.SqlBuilder.Operators
{
	/// <summary>
	/// Representa um operador SQL unário
	/// </summary>
	[Serializable]
	public abstract class UnaryOperator : SQLOperator
	{
		/// <summary>
		/// Representa a expressão da sentença
		/// </summary>
		public ISQLStatement Expression { get; set; }
		/// <summary>
		/// Identifica a operação
		/// </summary>
		public abstract string Operator { get; }

		protected UnaryOperator(ISQLStatement expression)
		{
			this.Expression = expression;
		}

		/// <summary>
		/// Retorna o SQL com da operação
		/// </summary>
		public override string ToSQL()
		{
			return string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0} ( {1} )", this.Operator, this.Expression.ToSQL());
		}

	}
}
